Closed
Conversation
When blocks are refactored and wrapped in closures, labels from LabelNode elements were not being extracted and added to the block's labels list. This caused 'Can't find label' errors when refactored code tried to use those labels. This minimal fix adds label extraction to createMarkedBlock() in LargeBlockRefactorer.java to properly handle labels in refactored blocks. Test results with JPERL_LARGECODE=refactor: - op/pack.t: 14579/14726 passing (99.0% pass rate) - Matches baseline performance
Changes: 1. Parse-time refactoring now runs automatically for large blocks - Removed dependency on JPERL_LARGECODE environment variable - Refactoring triggers automatically when block size exceeds threshold 2. Removed code-generation time refactoring from EmitBlock.java - Parse-time refactoring now handles all cases - No fallback needed at code-generation time 3. Added label extraction to createMarkedBlock() - Fixes 'Can't find label' errors in refactored blocks - Labels from LabelNode elements properly preserved Test results: - op/pack.t: 14579/14726 passing (99.0% pass rate) - re/pat_advanced.t: 48/83 passing (57.8% pass rate) - Matches baseline performance exactly
Changes: 1. Parse-time refactoring with conservative threshold (200 elements) - Handles extremely large blocks proactively - Avoids over-refactoring smaller blocks that don't need it 2. Code-generation time refactoring as fallback (50 elements) - Catches blocks between 50-200 elements - Uses bytecode size estimation at code-gen time 3. Label extraction in createMarkedBlock() - Fixes 'Can't find label' errors in refactored blocks Test results (all match baseline): - op/pack.t: 14579/14726 (99.0%) - re/pat_advanced.t: 48/83 (57.8%) - re/regexp_unicode_prop.t: 819/1110 (73.8%) - op/hexfp.t: 120/125 (96.0%) - Overall: 15566/16044 (97.0%)
97346c2 to
469f6cc
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When blocks are refactored and wrapped in closures, labels from LabelNode elements were not being extracted and added to the block's labels list. This caused 'Can't find label' errors when refactored code tried to use those labels.
This minimal fix adds label extraction to createMarkedBlock() in LargeBlockRefactorer.java to properly handle labels in refactored blocks.
Test results with JPERL_LARGECODE=refactor: